#! /usr/bin/env python

import rospy
from plumbing_pub_sub.msg import Person

if __name__ == '__main__':
    # 初始化节点
    rospy.init_node("daMa")
    # 实例化发布者对象
    pub = rospy.Publisher("jiaoSheTou", Person, queue_size=10)
    # 填写数据内容
    data = Person()
    data.age = 8
    data.name = "奥特曼"
    data.height = 1.78
    rate = rospy.Rate(10)
    # 发布数据
    while not rospy.is_shutdown():
        # 发布数据
        pub.publish(data)
        rospy.loginfo("发布的数据的姓名:%s 年龄:%d 身高:%.2f ",
                      data.name, data.age, data.height)
        data.age += 1
        rate.sleep()
